package cn.study.feignclient.controller;

import cn.study.feignclient.simple.FirstFeignClient;
import cn.study.feignclient.simple.GZipFeignClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class FirstController {


    @Autowired
    private FirstFeignClient firstFeignClient;

    @Autowired
    private GZipFeignClient gZipFeignClient;

    @GetMapping(value = "/search/github")
    public String searchGit(String q){
        return firstFeignClient.searchRepo(q);
    }

    @GetMapping(value = "/search/github/gzip")
    public ResponseEntity<byte[]> searchGitGzip(String q){
        ResponseEntity<byte[]> buff = gZipFeignClient.searchPepo(q);
        return gZipFeignClient.searchPepo(q);
    }


}
